# 1 导包
import unittest
import app
from lib.HTMLTestRunnerCN import HTMLTestRunner
from script.test_ego import TestEgo

# 2 创建测试套件
suite = unittest.TestSuite()

# 3 将测试用例添加到测试套件
suite.addTest(unittest.makeSuite(TestEgo))

# 4 定义测试报告的名称
reportname = app.BASE_DIR + "/report/mini_ego.html"

# 5 使用 HTMLRunner 生成测试报告
with open(reportname, "wb") as f:

    # 6 实例化 HTMLRunner
    runner = HTMLTestRunner(f, 2, "ego商城的接口测试报告")

    # 7 runner 运行测试套件
    runner.run(suite)
